Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PC-34083)[API] fix: pro: draft offer: always check if EAN is used #15965

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jbaudet-pass
Copy link
Contributor

But de la pull request

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-34083

Avant

Sur le portail pro, il était possible d'éditer en de publier une offre en brouillon même si l'EAN était déjà utilisé par une offre publiée.
Pour l'offre en brouillon, il faut la créer, en publier une avec le même EAN et revenir dessus : il n'y a plus de vérification sur l'EAN.

Après

La vérification au niveau de l'EAN se fait au moment de la publication et de l'édition d'un brouillon d'offre, et plus seulement à sa création.

Copy link
Contributor

github-actions bot commented Jan 21, 2025

Visit the preview URL for this PR (updated for commit 7ec9126):

https://pc-pro-testing--pr15965-pc-34083-block-pendi-i9lv1ws4.web.app

(expires Thu, 30 Jan 2025 16:56:06 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 032d233ee67e1c50d6af12e29c936c7076770eb1

@jbaudet-pass jbaudet-pass force-pushed the PC-34083/block_pending_offer_update_if_published_offer_with_same_ean_exists branch from 3b9f3e8 to 13184c1 Compare January 22, 2025 10:37
Copy link
Contributor

@tcoudray-pass tcoudray-pass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tu peux clore cette PR parce que le check sur l'EAN est déjà fait dans check_offer_extra_data .

@jbaudet-pass jbaudet-pass force-pushed the PC-34083/block_pending_offer_update_if_published_offer_with_same_ean_exists branch 2 times, most recently from 100ff2a to 7ec9126 Compare January 28, 2025 16:53
Before publishing or updating a draft offer, the EAN should always be
checked: if it is already used by another published (managed by the same
venue), the edit or updated operation should fail.
Copy link
Contributor

@tcoudray-pass tcoudray-pass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deux petits retours à corriger sinon 👍🏻

Comment on lines +222 to +224
class DraftOfferFactory(OfferFactory):
isActive = False

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je crois qu'il faut que tu rajoutes cela pour que ta factory soit complète.

Suggested change
class DraftOfferFactory(OfferFactory):
isActive = False
class DraftOfferFactory(OfferFactory):
isActive = False
validation = OfferValidationStatus.DRAFT

Comment on lines +281 to +284
if offer.extraData:
if ean := offer.extraData.get(ExtraDataFieldEnum.EAN.value):
validation.check_other_offer_with_ean_does_not_exist(ean, offer.venue, offer.id)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour l'update je pense que tu peux enlever cette partie. Effectivement dans certain cas le check ne sera pas parfait (si on n'a pas changé les "extraData" et que pourtant entre temps une offre a été publiée avec l'ean qui était dans l'extraData existant) mais ce n'est pas si grave.

Le plus important c'est de bloquer la publication de l'offre.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants